<?php
namespace app\user\controller;
use think\Db;
use EasyWeChat\Foundation\Application;
use EasyWeChat\Payment\Order;
class Operator extends Common
{
    public function index()
    {
    	

    }
    //获取协议
    public function getprotocol()
    {
        $oid = 1;
        $types = input('param.types');

    	$info = Db::name('agreement')
            ->where('id',$oid)
            ->field('xy'.$types)
    		->find();



    	if($info){
            $key = 'xy'.$types;
            $info = $info[$key];

            return $info;
        }else{
            return '';
        }

    }
    //获取订单详情
    public function getleaseorder(){
        $oid = 1;
        $openid = mwdecrypt(input('param.openid'));
        $orderid = input('param.orderid');

        //获取运营商价格
        $info['operator'] = Db::name('operator')
            ->where('id',$oid)
            ->field('amount,billingunit,billingtime')
            ->find();
        //获取订单详情
        $info['leaseorder'] = Db::name('leaseorder')
            ->where('oid',$oid)
            ->where('id',$orderid)
            ->find();
        return $info;

    }

}
